package com.yc.demo.web;

import com.yc.demo.mapper.TestMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class IndexAction {

    @RequestMapping("hello")
    public String hello(
            @RequestParam (defaultValue =  "SpringBoot")String name
    ){

        return "hello"+name;
    }
    @Value("${demo.name}")
    String myname;
    @Value("${demo.age:100}")
    int age;
    @GetMapping("myinfo")
    public String myinfo(){
        return myname + ";"+ age;
    }
    @Resource
    TestMapper testMapper;

    @GetMapping("queryAccount")
    public List<?> queryAccount(){
        return testMapper.selectAllAcount();
    }

    @RequestMapping("demo")
    public String demo(){
        return "demo";
    }
}
